import { TableColumnCtx } from "element-plus/es/components/table/src/table-column/defaults";
import { TableHeader } from "../../index/indexTableConfig";
import { tableConfig } from "@/config/tableConfig";
const filterTag = (props: {
  value: string;
  row: TableHeader;
  column: TableColumnCtx<TableHeader>;
}) => {
  return props.row.tag === props.value;
};
const config = tableConfig({
  column: [
    {
      prop: "id",
      label: "用户id",
      sortable: true,
      minWidth: "100",
      fixed: true,
      show: false,
    },
    { prop: "name", label: "用户姓名", minWidth: "200" },
    {
      prop: "realname",
      label: "真实姓名",
      minWidth: "200",
      render: () => {
        return <div>123</div>;
      },
    },
    {
      prop: "tag",
      label: "标签",
      minWidth: "100",
      slotName: "filters",
      type: "select",

      filters: [
        { text: "123", value: "123" },
        { text: "312", value: "312" },
      ],
      filterMethod: (
        value: string,
        row: TableHeader,
        column: TableColumnCtx<TableHeader>,
      ) => {
        return filterTag({ value, row, column });
      },
    },
    {
      prop: "status",
      type: "select",
      label: "状态",
      minWidth: "200",
      slotName: "status",
    },
    {
      label: "操作",
      minWidth: "120",
      slotName: "handler",
      fixed: "right",
      show: false,
    },
  ],
  showIndexColumn: true,
  showSelectColumn: true,
});
export default config;
